function genProps(attrs) {
    let str = ''
    attrs.forEach(attr=>{
        if(attr.name === 'style') {
            const obj = {}
            attr.value.split(';').forEach(item=>{
                const [key,value] = item.split(':')
                obj[key] = value
            })
        }
        str+=`${attr.name}:${JSON.stringify(attr.value)},`
    })
    // 去掉最后的逗号
    return `{${str.slice(0,-1)}}`
}

export function generate(el) {
  console.log(el);
  const code = `_c(${el.tag},${el.attrs.length ? `${genProps(el.attrs)}` : "null"})`;
  console.log(code);
}
